import FileReader from "./file-reader.js";
import EntryPrinter from "./entry-printer.js";
import checksum from "./middlewares/entry/checksum.js";
import stdout from "./middlewares/printer/stdout.js";
import illegal from "./middlewares/entry/illegal.js";
import amb from "./middlewares/entry/amb.js";
import Entry from "./entry.js";
import strings from "./middlewares/entry/strings.js";
import errorIllegal from "./middlewares/entry/error-illegal.js";

const printer = new EntryPrinter()

const story1 =
    ' _  _  _  _  _  _  _  _  _ \n' +
    '| || || || || || || || || |\n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '                           \n' +
    '                           \n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '|_ |_ |_ |_ |_ |_ |_ |_ |_ \n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '                           \n' +
    '                           \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_ |_ |_ |_ |_ |_ |_ |_ |_ \n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_ |_ |_ |_ |_ |_ |_ |_ |_ \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '                           \n' +
    '    _  _     _  _  _  _  _ \n' +
    '  | _| _||_||_ |_   ||_||_|\n' +
    '  ||_  _|  | _||_|  ||_| _| \n' +
    '                           \n'

const story3 =
    ' _  _  _  _  _  _  _  _    \n' +
    '| || || || || || || ||_   |\n' +
    '|_||_||_||_||_||_||_| _|  |\n' +
    '                           \n' +
    ' _  _  _  _  _  _  _  _    \n' +
    '| || || || || || || ||_|  |\n' +
    '|_||_||_||_||_||_||_| _|  |\n' +
    '                           \n' +
    '    _  _  _  _  _  _     _ \n' +
    '|_||_|| || ||_   |  |  | _ \n' +
    '  | _||_||_||_|  |  |  | _|\n' +
    '                           \n' +
    '    _  _     _  _  _  _  _ \n' +
    '  | _| _||_| _ |_   ||_||_|\n' +
    '  ||_  _|  | _||_|  ||_| _ \n' +
    '                            \n'

const story4 =
    '                           \n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '  |  |  |  |  |  |  |  |  |\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    ' _|| || || || || || || || |\n' +
    '|_ |_||_||_||_||_||_||_||_|\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_ |_ |_ |_ |_ |_ |_ |_ |_ \n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_ |_ |_ |_ |_ |_ |_ |_ |_ \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    '\n' +
    ' _  _  _  _  _  _  _  _  _ \n' +
    '|_||_||_||_||_||_||_||_||_|\n' +
    ' _| _| _| _| _| _| _| _| _|\n' +
    '\n' +
    '    _  _  _  _  _  _     _ \n' +
    '|_||_|| || ||_   |  |  ||_ \n' +
    '  | _||_||_||_|  |  |  | _|\n' +
    '\n' +
    '    _  _     _  _  _  _  _ \n' +
    ' _| _| _||_||_ |_   ||_||_|\n' +
    '  ||_  _|  | _||_|  ||_| _|\n' +
    '\n' +
    ' _     _  _  _  _  _  _    \n' +
    '| || || || || || || ||_   |\n' +
    '|_||_||_||_||_||_||_| _|  |\n' +
    '\n' +
    '    _  _  _  _  _  _     _ \n' +
    '|_||_|| ||_||_   |  |  | _ \n' +
    '  | _||_||_||_|  |  |  | _|\n' +
    '\n'
Entry.reset().use(strings)
const file1 = new FileReader(story1)
console.log('======== STORY-1 =========')
printer.print(file1, stdout)


Entry.reset().use(strings).use(checksum).use(errorIllegal)
const file3 = new FileReader(story3)
console.log('======== STORY-3 =========')
printer.print(file3, stdout)


console.log('======== STORY-4 =========')
Entry.reset().use(strings).use(checksum).use(illegal).use(amb)
const file4 = new FileReader(story4);
printer.print(file4, stdout)
